package xj.graph2d.command;

import xj.graph2d.SimpleDrawDocument;
import xj.graph2d.SimpleDrawView;
import xj.graph2d.shapes.PolyShape;

public class RemoveVertexCommand extends DeltaCommand {

  public RemoveVertexCommand(SimpleDrawView view, 
			     SimpleDrawDocument doc,
			     PolyShape shape, 
			     int pos, 
			     float x, float y) {
    super(view, doc, shape);
    this.pos = pos;
    this.x = x;
    this.y = y;
  }

  @Override
  protected void forward() {
    ((PolyShape) shape).removePoint(pos);
  }

  @Override
  protected void backward() {
    ((PolyShape) shape).addPoint(pos, x, y, false);
  }

  protected int pos;

}
